/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.uniscol;

import fr.uniscol.model.Devoir;
import fr.uniscol.model.ServiceEnseignant;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author Christophe
 */
@Controller
public class DevoirController extends UniscolMainController{
    
    @RequestMapping("/devoir.create")
    public ModelAndView createDevoir(@RequestParam("serviceid") long serviceId, HttpSession session){
        
        Devoir devoir = new Devoir();
        devoir.setService(new ServiceEnseignant());
        devoir.getService().setId(serviceId);
        
        return new ModelAndView("devoir", "devoir", devoir);
    }
    
    public String saveDevoir(@ModelAttribute("devoir") Devoir devoir, HttpSession session){
        return "";
    }
}
